<template>
  <div class="sy">
    <!-- 头部 -->
    <div class="navbar">
      <van-nav-bar :border="false" @click-left="$router.push('/mine')">
        <template #title> <span class="fsbu">我的足迹</span> </template>
        <template #left>
          <van-icon name="arrow-left" color="#fcfcfd" size="18px" />
        </template>
      </van-nav-bar>
    </div>
    <!-- 送养详情 -->
    <div id="box">
      <div id="id" v-for="mub in item" :key="mub.ctid">
        <router-link :to="`/redetail/${mub.pid}`">
          <recommend
            :age="mub.age"
            :area="mub.area"
            :imgname="mub.imgname"
            :label="mub.label"
            :sex="mub.sex"
            :title="mub.nickname"
            :time="mub.time"
          />
        </router-link>
        <van-icon
          name="delete-o"
          id="aa"
          @click="submit(mub.uid, mub.nickname)"
        />
      </div>
    </div>
  </div>
</template>

<script>
import { getAllFade, delAllFade } from "@/api/ycmj";
import recommend from "@/components/recommend.vue";
import { Dialog } from "vant";
export default {
  data() {
    return {
      item: [],
      info: "",
      tit: "",
    };
  },

  methods: {
    submit(information, tii) {
      this.info = information;
      this.tit = tii;
      console.log(this.info);
      delAllFade({ uid: this.info, nickname: this.tit }).then((res) => {
        console.log(res);
        if (res.data.status == 200) {
          Dialog({ message: "删除成功" });
          this.a();
        }
      });
    },
    async a() {
      const data = await getAllFade({ uid: this.$store.state.user.uid });
      this.item = data.data.message;
      console.log(11111);
      console.log(this.item);
    },
  },
  mounted() {
    this.a();
  },
  components: {
    recommend,
  },
};
</script>

<style lang="scss" scoped>
#box {
  height: calc(100% - 94px);
  display: flex;
  flex-wrap: wrap;
  text-align: left;
  margin-left: 6px;
}
#id {
  margin: 0 8px;
  > #aa {
    font-size: 24px;
    position: relative;
    bottom: 90px;
    left: 120px;
    color: #fdd245;
  }
}
span,
a,
p,
strong,
i,
em {
  font-size: 0.3rem;
  white-space: nowrap;
}
.van-nav-bar {
  background-color: #f6c52b;
}
.sy {
  width: 100vw;
  height: 100vh;
  background-image: linear-gradient(
    #f6c52b,
    #f6c52b,
    #fbe397,
    #fdf1cd,
    #fefbf1,
    #fcfcfd
  );
  .fsbu {
    font-size: 0.5rem;
    color: #fefbf1;
  }
}
.van-card {
  width: 90%;
  margin: auto;
  margin-bottom: 10px;
  background: rgb(255, 255, 255);
  border-radius: 10px;
  box-shadow: 0px 0px 3px 0px rgba(207, 203, 203, 1);
  .van-card__title {
    font-size: 0.5rem;
    line-height: 1rem;
  }
  .van-card__header {
    display: flex;
    flex-direction: row;
  }
  .van-card__footer {
    width: 30px;
    float: right;
    margin-top: -25px;
    padding-right: 15px;
  }
}
.van-nav-bar {
  ::v-deep .van-icon {
    color: black;
  }
  ::v-deep .van-nav-bar__title {
    font-weight: bold;
    font-family: "黑体";
  }
}
</style>
